<template>
  <!-- 返回组件 -->
  <navTabrBack
    :navbackStyle="['padding-right: 20rpx']"
    :title="'我的消息'"
    :titleStyle="['padding: 0 28rpx;']"
  ></navTabrBack>
  <view class="content">
    <!-- 搜索历史 -->
    <!-- <view v-show="flage">
      <view class="serchHistory">
        <view>搜索历史</view>
        <view class="iconfont icon-huishouzhan_huaban"></view>
      </view>
      <view class="historyItem">一种用于农业改良土壤的农业设备</view>
      <view class="historyItem">一种用于备</view>
      <view class="historyItem"
        >一种用于农业农业设备一种用于农业农业设备一种用于农业农业设备一种用于农业农业设备
      </view>
    </view> -->
    <!-- 搜索专利列表 -->
    <view>
      <view class="serchItem" v-for="item,index in infoList" :key="index">
        <view>
          <view class="patentTitle">{{ item.content }}</view>
          <view class="patentClassify">我的消息内容！</view>
        </view>
        <view class="timeUser">{{ item.CreatedAt?.split("T")[0]}}</view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { toRefs, reactive, inject, onMounted  } from "vue";
const $url = inject("$url");
let data = reactive({
  infoList: []
});
let { infoList } = toRefs(data);
onMounted(()=>{
  //
  uni.getStorage({
    key: "useInfo",
    success: function (res) {
      if (res.token?.length < 1) {
        uni.navigateTo({
          url: "/pages/login/login?type=1",
        });
      }
      data.useInfo = res.data;
      uni.request({
        url: $url + `/zlMessage/getZlMessageList?page=1&pageSize=10&fromUserId=${res.data.ID}`,
        method: "GET",
        timeout: 6000,
        header: {
          "x-token": res.data.token,
        },
        fail: (err) => {
          console.log(err, "请求失败！");
        },
        success(res) {
          console.log(res.data.data.list);
          data.infoList = res.data.data.list;
        },
      });
    },
  });

})
</script>

<style scoped>
.timeUser {
  font-size: 25rpx;
  font-weight: 400;
  color: #888888;
}
/* 搜索历史 */
.serchHistory {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 43rpx;
  margin-bottom: 47rpx;
  font-size: 29rpx;
  font-weight: 400;
  color: #333333;
}
.serchHistory .iconfont {
  color: #999999;
  font-size: 32rpx;
}
.historyItem {
  display: inline-flex;
  height: 54rpx;
  line-height: 54rpx;
  background: #eeeeee;
  border-radius: 27rpx;
  margin-bottom: 36rpx;
  padding: 0 27rpx;
  overflow: hidden;
  text-overflow: ellipsis;
}
.content {
  padding: 0 28rpx;
  padding-bottom: 55rpx;
}

/* 搜索列表 */

/* 展示列表 */
.serchItem {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 32rpx;
  padding-bottom: 19rpx;
  border-bottom: 1rpx solid #F1F1F1;
}
.patentTitle {
  margin-top: 7rpx;
  width: 400rpx;
  font-size: 29rpx;
  font-weight: 400;
  color: #333333;
}
.patentClassify {
  margin-top: 9rpx;
  font-size: 25rpx;
  font-weight: 400;
  color: #888888;
}
</style>
